package com.googlecode.jgae.dao;

import com.googlecode.jgae.domain.BaseDomain;
import com.googlecode.objectify.Key;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * @author Denis Migol
 */
public interface DAO<ID extends Serializable, E extends BaseDomain<ID>> {
    E createNew();

    int count();

    List<E> query(int offset, int limit);

    List<Key<E>> queryKeys(int offset, int limit);

    E load(ID id);

    Map<ID, E> load(Iterable<ID> ids);

    ID save(E entity);

    Map<ID, E> save(Iterable<E> entities);

    void delete(E entity);

    void delete(ID id);

    void delete(Iterable<E> entities);

    void deleteIds(Iterable<ID> ids);
}
